package Hot100;

import common.TreeNode;

/**
 * @author zhangmin
 * @create 2022-01-02 17:56
 */
public class invertTree226 {

    /**
     * 226. 翻转二叉树
     * 翻转一棵二叉树。
     * 递归
     * */
    public TreeNode invertTree(TreeNode root) {
        if (root==null) return null;
        TreeNode left=invertTree(root.left);
        TreeNode right=invertTree(root.right);
        root.left=right;
        root.right=left;
        return root;
    }

}
